#include "led.h"

void led_control(uint8_t *cled)
{
	uint8_t temp = 0x00;
    static uint8_t temp_old = 0xff;
    for(int i=0;i<8;i++)
        temp |= (cled[i]<<(i));

    if(temp != temp_old)
    {
        GPIOC->ODR &= 0x00ff;
        GPIOC->ODR |=~ temp<<8;

        GPIOD->BSRR |= (0x01<<2);
        GPIOD->BRR |= (0x01<<2);

        temp_old = temp;
    }
}

uint8_t cled[] = {0,0,0,0,0,0,0,0};
void led_proc(void)
{
    led_control(cled);
}

